import requests

url = 'https://www.douguo.com/jingxuan/0'
head_data = {
    # 字典，需要有一个键值对
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}
html = requests.get(url, headers=head_data)
print(html.text)

import re

title = re.findall('<a class="cookname text-lips" href="/cookbook/.*?.html" target="_blank">(.*?)</a>',
                   html.text)
print(title)
#
# collect = re.findall('class="view">(.*?)<',
#                    html.text)
# print(collect)

# view

# <a class="cookname text-lips" href="/cookbook/3236730.html" target="_blank">#年夜饭上桌啦#黄瓜拌豆片</a>
# <a class="cookname text-lips" href="/cookbook/3236732.html" target="_blank">#年夜饭上桌啦#拌紫甘蓝</a>
